﻿@if (Open)
{
    <div class="shadow"></div>
    <div class="box">
        <div class="close" @onclick="Close">❌</div>
        <div class="box-content">
            @ChildContent
            <div class="box-item box-item-btn">
                <button class="box-btn" @onclick="OnClickCallback">@ButtonText</button>
                <button class="box-btn btn-primary" @onclick="Close">取消</button>
            </div>
        </div>
    </div>
}

@code {
    /// <summary>
    /// 组件内容
    /// </summary>
    [Parameter]
    public RenderFragment ChildContent { get; set; }

    /// <summary>
    /// 是否隐藏
    /// </summary>
    [Parameter]
    public bool Open { get; set; } = true;

    /// <summary>
    /// 按钮文字
    /// </summary>
    [Parameter]
    public string ButtonText { get; set; } = "确定";

    /// <summary>
    /// 确认按钮点击事件回调
    /// </summary>
    [Parameter]
    public EventCallback<MouseEventArgs> OnClickCallback { get; set; }

    /// <summary>
    /// 关闭Box
    /// </summary>
    private void Close() => Open = false;
}